/**
 * FileName: MyServlet
 * Author:   xing.yang@vcg.com
 * Date:     2020/2/27 10:14
 * Description:手动注入servlet
 */
package com.vcg.vdam.config;

import com.vcg.vdam.aop.TestServlet;
import com.vcg.vdam.aop.TestServlet2;
import org.springframework.boot.web.servlet.ServletRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class MyServletConfig {

    @Bean
    public ServletRegistrationBean testServletRegistrationBean() {
        ServletRegistrationBean registration = new ServletRegistrationBean(new TestServlet());
        registration.setEnabled(true);
        registration.addUrlMappings("/servlet/test");
        return registration;
    }

    @Bean
    public ServletRegistrationBean testServletRegistrationBean2() {
        ServletRegistrationBean registration = new ServletRegistrationBean(new TestServlet2());
        registration.setEnabled(true);
        registration.addUrlMappings("/servlet/test2");
        return registration;
    }

//    @Bean
//    public TestServlet2 testServlet2(){
//        return new TestServlet2();
//    }

}
